//
// Created by 文道江 on 15/11/25.
// Copyright (c) 2015 文道江. All rights reserved.
//

#ifndef __HYBRID_KV_STORAGE_HEADER__
#define __HYBRID_KV_STORAGE_HEADER__

#import <Foundation/Foundation.h>
#import "FMDB.h"
#import "DTSObject.h"
#import "DTSManager.h"

@interface KVStorageModel : DTSObject

@property(nonatomic, strong) NSString *key;
@property(nonatomic, strong) NSData *value;

@end

@interface KVStorage : NSObject

@property(nonatomic, strong) NSString *dbPath;
@property(nonatomic, strong) DTSManager *manager;

+ (KVStorage *)sharedStorage;

/**
 * 设置一条记录.
 * 如果不存在key则自动新增, 存在则修改
 */
+ (void)setKey:(NSString *)key Value:(id)value;

/**
 * 根据传入的 key 返回值
 */
+ (id)getValue:(NSString *)key;

/**
 * 如果存入的是 NSDictionary 可以直接使用这个方法读取出 NSDictionary
 * @param key
 * @return
 */
+ (NSDictionary *)getJsonValue:(NSString *)key;

- (void)setKey:(NSString *)key Value:(id)value;

- (id)getValue:(NSString *)key;

@end

#endif